Skip to content

feat: add default app and manifest watch config#89

Merged
zimeg merged 4 commits intomainfrom
zimeg-feat-hooks-watch
Feb 4, 2026
Merged

feat: add default app and manifest watch config#89
zimeg merged 4 commits intomainfrom
zimeg-feat-hooks-watch

Conversation

@zimeg
Copy link
Member

@zimeg zimeg commented Jan 30, 2026

Summary

This PR adds a default app and manifest option to file watching for server restarts and app reinstalls.

Following: slackapi/slack-cli#310

Testing

Build these changes with the CLI changes noted above. Then reinstall and reload an app:

$ slack run          # Run an app and keep it running
$ vim manifest.json  # Update the manifest file
$ vim app.py         # Update the app configuration
$ vim listeners/__init__.py  # Confirm nested directories work too

⚠️ Note: The manifest.source of ".slack/config.json" must be local for this to work with manifest changes!

Special notes

CLI version >=3.12.0 is required for these changes to be used in development, but these will be released in order or together if all goes well in review 👾

Requirements

  • I've read and understood the Contributing Guidelines and have done my best effort to follow them.
  • I've read and agree to the Code of Conduct.
  • I've run ./scripts/install_and_run_tests.sh after making the changes.

@zimeg zimeg added this to the 0.2.1 milestone Jan 30, 2026
@zimeg zimeg self-assigned this Jan 30, 2026
@zimeg zimeg requested a review from a team as a code owner January 30, 2026 07:23
@zimeg zimeg added enhancement New feature or request semver:minor labels Jan 30, 2026
@codecov
Copy link

codecov bot commented Jan 30, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.68%. Comparing base (ed1b892) to head (2fd4891).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #89   +/-   ##
=======================================
  Coverage   94.68%   94.68%           
=======================================
  Files          11       11           
  Lines         207      207           
=======================================
  Hits          196      196           
  Misses         11       11           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

@WilliamBergamin WilliamBergamin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested this out locally 🚀 The experience is much better then I expected 🌟

My only concern before merging this is that the CLI seems to be using a keyboard interrupt to stop the process and this is leading to a traceback being printed 🤔 I don't think this traceback should be printed when the CLI does its "refresh"

INFO:slack_bolt.App:Starting to receive messages from a new connection (session id: c946512435)
App change detected: ~/bolt-python-search-template/listeners/functions/search.py, restarting server...
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "~/bolt-python-search-template/.venv/lib/python3.13/site-packages/slack_cli_hooks/hooks/start.py", line 44, in <module>
    start(os.getcwd())
    ~~~~~^^^^^^^^^^^^^
  File "~/bolt-python-search-template/.venv/lib/python3.13/site-packages/slack_cli_hooks/hooks/start.py", line 37, in start
    runpy.run_path(entrypoint_path, run_name="__main__")
    ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen runpy>", line 287, in run_path
  File "<frozen runpy>", line 98, in _run_module_code
  File "<frozen runpy>", line 88, in _run_code
  File "~/bolt-python-search-template/app.py", line 19, in <module>
    SocketModeHandler(app, os.environ.get("SLACK_APP_TOKEN")).start()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "~/bolt-python-search-template/.venv/lib/python3.13/site-packages/slack_bolt/adapter/socket_mode/base_handler.py", line 58, in start
    Event().wait()
    ~~~~~~~~~~~~^^
  File "/Users/wbergamin/.pyenv/versions/3.13.1/lib/python3.13/threading.py", line 659, in wait
    signaled = self._cond.wait(timeout)
  File "/Users/wbergamin/.pyenv/versions/3.13.1/lib/python3.13/threading.py", line 359, in wait
    waiter.acquire()
    ~~~~~~~~~~~~~~^^
KeyboardInterrupt

Not sure if this is something we could handle on the CLI side 🤔 from my quick search it seems like sending a syscall.SIGTERM to the python process might prevent this tracback log from showing up

@zimeg
Copy link
Member Author

zimeg commented Feb 2, 2026

@WilliamBergamin Thanks a ton for taking this for a spin! 🚲 ✨

IIRC Windows doesn't support the same syscall signals that Unix setups often do. We use the most general interrupt between processes to avoid these platform nuances in CLI code:

https://github.com/slackapi/slack-cli/blob/66766a97e90046d9db7d5697d338d3ccea433c52/internal/pkg/platform/localserver.go#L259

The SIGILL and SIGTERM signals aren't generated under Windows.

🔗 https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/signal?view=msvc-170

I agree we might find improvements to these outputs - perhaps clearing the screen between restarts is useful - but for now this output might be alright toward iterations in app development?

@zimeg zimeg requested a review from WilliamBergamin February 3, 2026 20:14
Copy link
Member

@mwbrooks mwbrooks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ This works so well, I can't wait for it to land in the CLI's next release 😄

🧪 Local testing works well! 👾

💭 @WilliamBergamin raises a good point. I've noticed the same error output when we CTRL+C the slack run process. The error output isn't the most pleasant experience and it's good to know that we can solve it by using the syscall.SIGTERM on Unix/macOS.

My suggestion is that we can merge this PR and follow-up with a CLI improvement that uses syscall.SIGTERM on a Unix/macOS and falls back on KeyboardInterrupt for Windows and other platforms. Since the experience already exists on CTRL+C.

Comment on lines +23 to +31
"watch": {
"app": {
"filter-regex": "\\.py$",
"paths": ["."],
},
"manifest": {
"paths": ["manifest.json"],
},
},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

praise: So much simpler than the @slack/cli-hooks PR! 😆

@zimeg
Copy link
Member Author

zimeg commented Feb 4, 2026

@mwbrooks Thanks for suggesting a path forward in these changes. I agree that we can add sophistication to this experience as more feedback is shared.

@WilliamBergamin @mwbrooks Both of y'all's testing goes so far! Let's merge this now for a soon release 🚢 💨

@zimeg zimeg merged commit 2f57950 into main Feb 4, 2026
19 checks passed
@zimeg zimeg deleted the zimeg-feat-hooks-watch branch February 4, 2026 23:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request semver:minor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants